//LA Analysis (RED TAPE PAPER) Cynthia Edits 9.4.20// 
clear all
**Star out the other person's respective folder before running
*Bill's folder:
use "LASOS.dta" 
*Cynthia's folder:
*use "/Users/cynthiawilkes/Dropbox/Bill Resh/LACity/LASOS.dta"
*Import from Excel - convert string to numeric variables
destring, replace

/*

Cleaning the data set: 
- Step 1: rename variables from Qualtrics
- Step 2: create variable labels
- Step 3: define variable values
- Step 4: reverse code relevant variables 
*/

rename Progress progress
label variable progress "progress"

rename Durationinseconds duration
label variable duration "Duration (in seconds)"

rename ResponseId responseid
label variable responseid "Response ID"

rename LA_1 department
label variable department "department"

gen agency=1 if department==3 //Aging
replace agency=2 if department==24 //Airports
replace agency=3 if department==257 //Animal Services
replace agency=4 if department==285 //Building & Safety
replace agency=5 if department==358 //Canabis Regulation
replace agency=6 if department==363 //City Administrative Office
replace agency=7 if department==393 //City Attorney
replace agency=8 if department==432 //City Clerk
replace agency=9 if department==469 //City EMployees Retirement System
replace agency=10 if department==506 //City Ethics Commission
replace agency=11 if department==520 //City Planning
replace agency=12 if department==564 //COntroller
replace agency=13 if department==599 //Convention & Tourism Development Department
replace agency=14 if department==615 //Council
replace agency=15 if department==642 //Cultural Affairs
replace agency=16 if department==675 //Disability
replace agency=17 if department==686 //Economic & Workforce Development
replace agency=18 if department==731 //El Pueblo De Los Angeles Historical Monument Authority
replace agency=19 if department==743 //Emergency
replace agency=20 if department==759 //Fire
replace agency=21 if department==854 //General Services
replace agency=22 if department==1014 //Harbor
replace agency=23 if department==1213 //Housing & Community INvestment Department
replace agency=24 if department==1281 //Information Technology Agency
replace agency=25 if department==1331 //Library
replace agency=26 if department==1382 //Mayor
replace agency=27 if department==1396 //Neighborhood Empowerment
replace agency=28 if department==1411 //Office of Finance
replace agency=29 if department==1452 //Pensions
replace agency=30 if department==1485 //Personnel
replace agency=31 if department==1555 //Police
replace agency=32 if department==1694 //public works - board of public works
replace agency=33 if department==1720 //public works - contract administration
replace agency=34 if department==1747 // public works - engineering
replace agency=35 if department==1831 // public works - sanitation
replace agency=36 if department==1992 // public works - street lighting
replace agency=37 if department==2038 // public works - street services
replace agency=38 if department==2116 //Recreation & Parks
replace agency=39 if department==2301 //Transportation
replace agency=40 if department==2379 //Water & Power
replace agency=41 if department==2720 //Zoo
replace agency=42 if department==1 //Other
label define agency_lbl 1"Aging" 2"Airports" 3"Animal Services" 4"Building & Safety" 5"Canabis Regulation" 6"City Administrative Office" 7"City Attorney" 8"City Clerk" 9"City Employees Retirement System" 10"City Ethics Commission" 11"City Planning" 12"Controller" 13"Convention & Tourism Development Department" 14"Council" 15"Cultural Affairs" 16"Disability" 17"Economic & Workforce Development Department" 18"El Pueblo De Los Angeles Historical Monument Authority" 19"Emergency" 20"Fire" 21"General Services" 22"Harbor" 23"Housing and Community Investment Department" 24"Information Technology Agency" 25"Library" 26"Mayor" 27"Neighborhood Empowerment" 28"Office of Finance" 29"Pensions" 30"Personnel" 31"Police" 32"Public Works Board" 33"Public Works Contract Administration" 34"Public Works Engineering" 35"Public Works Sanitation" 36"Public Works Street Lighting" 37"Public Works Street Services" 38"Recreation & Parks" 39"Transportation"40"Water & Power" 41"Zoo" 42"Other"
label values agency agency_lbl
codebook agency

rename LA_2 position
label variable position "position"

rename Q190 otherdep
label variable otherdep "if selected other department"

rename Q190_1_TEXT otherpos_text
label variable otherpos_text "if selected other position - text response"

rename Q190_2_TEXT otherna
label variable otherna "if selected other for department or position - text response"

rename Q188 elecoff
label variable elecoff "elected official"
label define elecoff_lbl 1"Yes, I was elected" 2"No, I was hired" 3"No, I was appointed"
label values elecoff elecoff_lbl
codebook elecoff

*generate dummies
	tab elec
	tab elec, nolabel
	gen appointee=1 if elec==3				//appointed
	replace appointee=0 if appointee==.
	gen careerist=1 if elec==2				//hired
	replace careerist=0 if careerist==.
	gen elected=1 if elec==1				//elected
	replace elected=0 if elected==.

label variable topmgr "top manager"
label define topmgr_lbl 1"Yes" 2"No" 3"Not sure"
label values topmgr topmgr_lbl
codebook topmgr

rename Q160 gender1
label variable gender1 "gender"
label define gender1_lbl 1"male" 2"female" 3"trans female" 4"trans male" 5"gender variant" 6"not listed"
label values gender1 gender1_lbl
codebook gender1

	*generate female dummy
	gen female=1 if gender1==2
	replace female=0 if gender1==1 | gender1==3 | gender1==4 | gender1==5 | gender1==6 | female==.
	label define female_lbl 1"female" 0"non-female"
	label values female female_lbl
	tab female
	
	*generate gender other
	gen genother=1 if gender1==3 | gender1==4 | gender1==5 | gender1==6
	replace genother=0 if gender1==1 | gender1==2
	label define genother_lbl 1"non-binary gender" 0"binary gender"
	label values genother genother_lbl
	tab genother
	
	*generate male
	gen male=1 if gender1==1
	replace male=0 if gender1==2
	label define male_lbl 1"male" 0"female"
	label values male male_lbl
	tab male

rename Q160_6_TEXT gender2
label variable gender2 "gender not listed - text response"

rename Q182 livmun
label variable livmun "Do you currently live in the municipality for which you work?"
label define livmun_lbl 1"yes" 2"no"
label values livmun livemun_lbl
label define livmun1 1 "In Muni" 2 "Not in Muni"
label values livmun livmun1

rename Q164 yrborn
label variable yrborn "year born"

rename Q154 hispanic
label variable hispanic "Are you of Hispanic, Latino, or of Spanish origin?"
label define hispanic_lbl 1"yes" 2"no"
label values hispanic hispanic_lbl
codebook hispanic

rename Q166 race
label variable race "race and ethnicity"
label define race_lbl 1"american indian / alaskan" 2"asian" 3"black" 4"pacific islander" 5"white" 6"other"
/*may not label strings
label values race race_lbl 
codebook race*/

label variable race2 "race and ethnicity - expanded"
label define race2_lbl 1"american indian / alaskan" 2"asian" 3"black" 4"pacific islander" 5"white" 6"white hispanic" 7"black hispanic" 8"mixed hispanic" 9"mixed" 10"other"
label values race2 race2_lbl 
codebook race2

*generate white dummy
	gen white=1 if race2==5
	replace white=. if race2==.
	replace white=2 if race2==1 | race2==2 | race2==3 | race2==4 | race2==6 |  race2==7 | race2==8 | race2==9 | race2==10
	label define white 1 "white" 2 "non-white"
	label values white white
	codebook white

label variable racemixed "mixed race categories selected"
/*responses are multiselect and treated as a string, separated by commas
1"american indian / alaskan" 
2"asian" 
3"black" 
4"pacific islander" 
5"white" 
6"other"*/

rename Q166_6_TEXT raceother
label variable raceother "race not listed - text response"

rename Q168 educ
label variable educ "education"
label define educ_lbl 1"less than high school" 2"high school/GED" 3"some college" 4"2-year college" 5"4-year college" 6"post-graduate"
label values educ educ_lbl
codebook educ

rename Z majfield
label variable majfield "major or field of most advanced degree"

rename Q164_17_TEXT majfield_text
label variable majfield_text "major or field of most advanced degree - text response"

rename Q156 polview
label variable polview "political view_extremely liberal to extremely conservative"
label define polview_lbl 1"extremely liberal" 2"liberal" 3"slightly liberal" 4"moderate, middle of the road" 5"slightly conservative" 6"conservative" 7"extremely conservative" 8"haven't thought much about it"
label values polview polview_lbl
codebook polview
*note: value 8 is undecided

*Correcting Ideology
	tab polview
	tab polview, nolabel
	gen ideology=polview if polview!=8
	replace ideology=4 if polview==8
	label define ideology_lbl 1"extremely liberal" 2"liberal" 3"slightly liberal" 4"moderate, middle of the road" 5"slightly conservative" 6"conservative" 7"extremely conservative"
	label values ideology ideology_lbl
	codebook ideology
	tab ideology

rename Q161 yrsworkedmun
label variable yrsworkedmun "How many years have you worked for your municipality in total?"

rename Q162 rolsupervise
label variable rolsupervise "In your role, approximately how many employees and outside contractors do you DIRECTLY supervise?"

*generate supervisory relationship variables
	gen supervise_less2=1 if rolsupervise==1 							//Dummy Supervises 0-1 employees
	replace supervise_less2=0 if supervise_less2==.
	label define supervise_less2_lbl 1"Supervises 0-1 employees" 
	label values supervise_less2 supervise_less2_lbl
	tab supervise_less2

	gen supervise_smallteam=1 if rolsupervise==2 | rolsupervise==3 | rolsupervise==4 | rolsupervise==5 | rolsupervise==6 | rolsupervise==7 | rolsupervise==8 | rolsupervise==9 	//Dummy Supervises 2-9 employees
	replace supervise_smallteam=0 if supervise_smallteam==.
	label define supervise_smallteam_lbl 1"Supervises 2-9 employees" 
	label values supervise_smallteam supervise_smallteam_lbl
	tab supervise_smallteam

	gen supervise_largeteam=1 if rolsupervise==10 | rolsupervise==11	//Dummy Supervises 10+ employees
	replace supervise_largeteam=0 if supervise_largeteam==.
	label define supervise_largeteam_lbl 1"Supervises 10+ employees" 
	label values supervise_largeteam supervise_largeteam_lbl
	tab supervise_largeteam

	gen teamsize=1 if rolsupervise==1 
	replace teamsize=2 if rolsupervise==2 | rolsupervise==3 | rolsupervise==4 | rolsupervise==5 | rolsupervise==6 | rolsupervise==7 | rolsupervise==8 | rolsupervise==9 
	replace teamsize=3 if rolsupervise==10 | rolsupervise==11

	label define teamsize_lbl 1"0-1 Supervisees" 2"Small Team: 2-9 Supervisees" 3"Large Team: 10+ Supervisees" 
	label values teamsize teamsize_lbl
	codebook teamsize

rename PM1 prosocial1
label variable prosocial1 "Why are you motivated to do your work? Because I care about benefiting others through my work."
label define prosocial1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"stronngly agree"
label values prosocial1 prosocial1_lbl
codebook prosocial1

rename PM2 prosocial2
label variable prosocial2 "Why are you motivated to do your work? Because I want to help others through my work."
label define prosocial2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"stronngly agree"
label values prosocial2 prosocial2_lbl
codebook prosocial2

rename PM3 prosocial3
label variable prosocial3 "Why are you motivated to do your work? Because it is important to me to do good for others through my work."
label define prosocial3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"stronngly agree"
label values prosocial3 prosocial3_lbl
codebook prosocial3

rename PM4 prosocial4
label variable prosocial4 "Why are you motivated to do your work? Because I want to have a positive impact on others."
label define prosocial4_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values prosocial4 prosocial4_lbl
codebook prosocial4

*prosocial average
	egen prosocialavg = rowmean(prosocial1 prosocial2 prosocial3 prosocial4)	//Note: LB data has slightly different questions for these averages


rename PEMP1 psychemp1
label variable psychemp1 "psychological empowerment_The work I do is meaningful to me"
label define psychemp1_lbl  1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values psychemp1 psychemp1_lbl
codebook psychemp1

rename PEMP2 psychemp2
label variable psychemp2 "psychological empowerment_I am confident about my ability to do my job."
label define psychemp2_lbl  1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values psychemp2 psychemp2_lbl
codebook psychemp2

rename Q104 psychemp3
label variable psychemp3 "psychological empowerment_I can decide on my own how to go about doing my work."
label define psychemp3_lbl  1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values psychemp3 psychemp3_lbl
codebook psychemp3

rename Q105 psychemp4
label variable psychemp4 "psychological empowerment_I have significant influence over what happens in my department."
label define psychemp4_lbl  1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values psychemp4 psychemp4_lbl
codebook psychemp4

*psychological empowerment average
	egen psychempavg = rowmean(psychemp1 psychemp2 psychemp3 psychemp4)

rename REMP1 relemp1
label variable relemp1 "relational empowerment_Managers effectively communicate their goals to employees."
label define relemp1_lbl  1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values relemp1 relemp1_lbl
codebook relemp1

rename REMP2 relemp2
label variable relemp2 "relational empowerment_Promotions depend on how well employees perform their jobs."
label define relemp2_lbl  1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values relemp2 relemp2_lbl
codebook relemp2

*relational empowerment 
	egen relempavg = rowmean (relemp1 relemp2)
	egen psychrelempavg = rowmean(psychemp1 psychemp2 psychemp3 psychemp4 relemp1 relemp2)	

rename EMPL2 emplead1
label variable emplead1 "empowering leadership_My manager helps me understand the importance of my work to the overall effectiveness of the organization."
label define emplead1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values emplead1 emplead1_lbl
codebook emplead1

rename EMPL4 emplead2
label variable emplead2 "empowering leadership_My manager makes many decisions together with me."
label define emplead2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values emplead2 emplead2_lbl
codebook emplead2

rename EMPL11 emplead3
label variable emplead3 "empowering leadership_My manager  believes that I can handle demanding tasks."
label define emplead3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values emplead3 emplead3_lbl
codebook emplead3

rename Q107 emplead4
label variable emplead4 "empowering leadership_My manager allows me to do my job my way."
label define emplead4_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values emplead4 emplead4_lbl
codebook emplead4

	*generate average of empowering leadership
	egen empleadavg = rowmean(emplead1 emplead2 emplead3 emplead4)

*generate dummy for empowered by leadership
gen empowered=1 if emplead1>4 | emplead2>4 | emplead3>4 |emplead4>4
replace empowered=0 if empowered==.
label variable empowered "empowered by their manager"
label define empowered_lbl 1"empowered"
label values empowered empowered_lbl
codebook empowered

*generate dummy for empowered by leadership
gen empowered1=1 if empleadavg>4
replace empowered1=0 if empowered1==.
label variable empowered1 "empowered by their manager"
label define empowered1_lbl 1"empowered"
label values empowered1 empowered1_lbl
codebook empowered1

rename Q654 manager1
label variable manager1 "manager help - I help my employees to understand the importance of their work to the overall effectiveness of the organization."
label define manager1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values manager1 manager1_lbl
codebook manager1

rename Q655 manager2
label variable manager2 "manager decisions - I make many decisions together with my employees."
label define manager2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values manager2 manager2_lbl
codebook manager2

rename Q656 manager3
label variable manager3 "manager trust - I trust my employees to handle demanding tasks."
label define manager3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values manager3 manager3_lbl
codebook manager3

rename Q657 manager4
label variable manager4 "manager discretion - I allow my employees to do their job the best way they see fit."
label define manager4_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values manager4 manager4_lbl
codebook manager4

rename ORGP1_1 orgperf1
label variable orgperf1 "Overall performance in my department last year was:"
label define orgperf1_lbl 1"very poor" 10"very good"
label values orgperf1 orgperf1_lbl
codebook orgperf1

	*generate dummies
	gen highperfdept=1 if orgperf1>=7		//Dummy: HIGH performing departments
	replace highperfdept=0 if highperfdept==.

	gen lowperfdept=1 if orgperf1<7			//Dummy: LOW performing departments
	replace lowperfdept=0 if lowperfdept==.

	*generate discrete values
	gen orgperf1a=1 if orgperf1<=1
	replace orgperf1a=2 if orgperf1>1 & orgperf1<=2
	replace orgperf1a=3 if orgperf1>2 & orgperf1<=3
	replace orgperf1a=4 if orgperf1>3 & orgperf1<=4
	replace orgperf1a=5 if orgperf1>4 & orgperf1<=5
	replace orgperf1a=6 if orgperf1>5 & orgperf1<=6
	replace orgperf1a=7 if orgperf1>6 & orgperf1<=7
	replace orgperf1a=8 if orgperf1>7 & orgperf1<=8
	replace orgperf1a=9 if orgperf1>8 & orgperf1<=9
	replace orgperf1a=10 if orgperf1>9 & orgperf1<=10
	tab orgperf1a
	
rename Q108_1 orgperf2
label variable orgperf2 "My own performance on the job last year was:"
label define orgperf2_lbl 1"very poor" 10"very good"
label values orgperf2 orgperf2_lbl
codebook orgperf2

*generate dummies
	gen highperfindiv=1 if orgperf2>=8				//Dummy: HIGH performing individuals
	replace highperfindiv=0 if highperfindiv==.

	gen lowperfindiv=1 if orgperf2<8				//Dummy: LOW performing individuals
	replace lowperfindiv=0 if lowperfindiv==.

tab TIRT1_9
tab TIRT2_1
tab TIRT3_1

rename TIRT1_9 rt_burden
label variable rt_burden "policies and procedures in department_not burdensome or burdensome"
label define rt_burden_lbl 0"not burdensome" 7"burdensome"
label values rt_burden rt_burden_lbl
codebook rt_burden

rename TIRT2_1 redtape2
label variable redtape2 "policies and procedures in department_not necessary or necessary"
label define redtape2_lbl 0"not necessary" 7 "necessary"
label values redtape2 redtape2_lbl
codebook redtape2
*reverse code
generate rt_unnecess=7-redtape2
label variable rt_unnecess "reverse coded redtape2 - Necessity"
label define rt_unnecess_lbl 0"necessary" 7"not necessary"
label values rt_unnecess rt_unnecess_lbl
codebook rt_unnecess

rename TIRT3_1 redtape3
label variable redtape3 "policies and procedures in department_not effective or effective"
label define redtape3_lbl 0"ineffective" 7"effective
label values redtape3 redtape3_lbl
codebook redtape3
*reverse code
generate rt_ineffect=7-redtape3
label variable rt_ineffect "reverse coded redtape3 - Effectiveness"
label define rt_ineffect_lbl 0"effective" 7"ineffective"
label values rt_ineffect rt_ineffect_lbl
codebook rt_ineffect

rename I1 innov1
label variable innov1 "innovation_New technologies have made it easier to engage with citizens in our municipality."
label define innov1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values innov1 innov1_lbl
codebook innov1

rename I1a innov2
label variable innov2 "Please indicate which new technology, in particular, you most readily associate with citizen engagement - text response"

rename I4 innov3
label variable innov3 "innovation_public feedback has improved our work"
label define innov3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values innov3 innov3lbl
codebook innov3

rename F1 fair1
label variable fair1 "fairness_job decisions are made by management in unbiased manner"
label define fair1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values fair1 fair1_lbl
codebook fair1

rename F5 fair2
label variable fair2 "fairness_my performance approaisal for the last year was a fair reflection of my performance"
label define fair2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values fair2 fair2_lbl
codebook fair2

rename OT1 orgtrust1
label variable orgtrust1 "organizational trust_trustworthiness_Top management is very capable of performing its job"
label define orgtrust1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values orgtrust1 orgtrust1_lbl
codebook orgtrust1

rename OT2 orgtrust2
label variable orgtrust2 "organizational trust_benevolence_Top management is very concerned about my welfare."
label define orgtrust2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values orgtrust2 orgtrust2_lbl
codebook orgtrust2

rename Q133 orgtrust3
label variable orgtrust3 "organizational trust_integrity_Top management's actions and behaviors are not very consistent."
label define orgtrust3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values orgtrust3 orgtrust3_lbl
codebook orgtrust3
*reverse code
generate Rorgtrust3=8-orgtrust3
label variable Rorgtrust3 "reverse coded orgtrust3_management not consistent"
label define Rorgtrust3_lbl 1"strongly agree" 2"agree" 3"agree somewhat" 4"neither agree nor disagree" 5"disagree somewhat" 6"disagree" 7"strongly disagree"
label values Rorgtrust3 Rorgtrust3_lbl
codebook Rorgtrust3

rename Q134 orgtrust4
label variable orgtrust4 "organizational trust_I would be comfortable giving top management a task or problem which was critical to me, even if I could not monitor their actions."
label define orgtrust4_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values orgtrust4 orgtrust4_lbl
codebook orgtrust4

rename Q659 trustmgr1
label variable trustmgr1 "My employees believe that I am very capable of performing my job."
label define trustmgr1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values trustmgr1 trustmgr1_lbl
codebook trustmgr1

rename Q660 trustmgr2
label variable trustmgr2 "My employees know that I am concerned about their welfare."
label define trustmgr2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values trustmgr2 trustmgr2_lbl
codebook trustmgr2

rename Q661 trustmgr3
label variable trustmgr3 "My actions and behaviors as a manager are very consistent."
label define trustmgr3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values trustmgr3 trustmgr3_lbl
codebook trustmgr3

rename Q662 trustmgr4
label variable trustmgr4 "I would be comfortable giving my employees a task or problem which was critical to me, even if I could not monitor their actions."
label define trustmgr4_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values trustmgr4 trustmgr4_lbl
codebook trustmgr4

rename IJOC1 jobcharacter
label variable jobcharacter "job characteristics_Routine duties and paperwork interfere with my job."
label define jobcharacter_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values jobcharacter jobcharacter_lbl
codebook jobcharacter

rename ECP1 citsupport1
label variable citsupport1 "external climate and pol environment_I receive a great deal of support from citizens for the work I do"
label define citsupport1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values citsupport1 citsupport1_lbl
codebook citsupport1

	*generate 3-point scale
	gen citsupport1_3scale=1 if citsupport1>=5
	replace citsupport1_3scale=2 if citsupport1==4
	replace citsupport1_3scale=3 if citsupport1<=3
	label define citsupport1_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values citsupport1_3scale citsupport1_3scale_lbl
	tab citsupport1_3scale	// I receive a great deal of support from residents for the work I do (1"agree" 2"neither" 3"disagree")

	*dummy for supported
	gen supported=1 if citsupport1>=5
	replace supported=0 if supported==.
	
	gen notsupported=1 if citsupport1<=3
	replace notsupported=0 if notsupported==.
	
rename ECP2 citsupport2
label variable citsupport2 "external cilimate and pol environment_reversecode_lack of citizen support"
label define citsupport2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values citsupport2 citsupport2_lbl
codebook citsupport2
*reverse code
generate Rcitsupport2=8-citsupport2
label variable Rcitsupport2 "reverse coded_lack of citizen involvement is a problem for organization"
label define Rcitsupport2_lbl 1"strongly agree" 2"agree" 3"agree somewhat" 4"neither agree nor disagree" 5"disagree somewhat" 6"disagree" 7"strongly disagree"
label values Rcitsupport2 Rcitsupport2_lbl
codebook citsupport2
codebook Rcitsupport2

	*generate 3-point scale
	gen citsupport2_3scale=1 if citsupport2>=5
	replace citsupport2_3scale=2 if citsupport2==4
	replace citsupport2_3scale=3 if citsupport2<=3
	label define citsupport2_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values citsupport2_3scale citsupport2_3scale_lbl
	tab citsupport2_3scale	//Lack of resident involvement is a problem for our organization (1"agree" 2"neither" 3"disagree")

	*generate dummy
	gen engagenoprob=1 if citsupport2<=3	//Dummy: DO NOT see lack of resident engagement as a problem
	replace engagenoprob=0 if engagenoprob==.

	gen engageprob=1 if citsupport2>=5 		//Dummy: DO see lack of resident engagement as a problem
	replace engageprob=0 if engageprob==.


rename EL7 engtime
label variable engtime "Please indicate the average percentage of the week that you dedicate to direct engagement with citizens."
label define engtime_lbl 10"0-9%" 9"10-19%" 8"20-29%" 7"30-39%" 6"40-49%" 5"50-59%" 4"60-69%" 3"70-79%" 2"80-89%" 1"90-100%"
label values engtime engtime_lbl
codebook engtime
*reverse code
gen Rengtime=1 if engtime==10 	//0-9%
replace Rengtime=2 if engtime==9 	//10-19%
replace Rengtime=3 if engtime==8 	//20-29%
replace Rengtime=4 if engtime==7 	//30-39%
replace Rengtime=5 if engtime==6 	//40-49%
replace Rengtime=6 if engtime==5 	//50-59%
replace Rengtime=7 if engtime==4 	//60-69%
replace Rengtime=8 if engtime==3 	//70-79%
replace Rengtime=9 if engtime==2 	//80-89%
replace Rengtime=10 if engtime==1 //90-100%
label define Rengtime_lbl 1"0-9%" 2"10-19%" 3"20-29%" 4"30-39%" 5"40-49%" 6"50-59%" 7"60-69%" 8"70-79%" 9"80-89%" 10"90-100%"
label values Rengtime Rengtime_lbl
tab Rengtime

	*generate dummies
	gen engage50=1 if engtime<=5			//Dummy: >50% of time spent engaging residents
	replace engage50=0 if engage50==.

	*generate variable for engagement time >= 50% 
	gen eng_high=1 if engtime==1 | engtime==2 | engtime==3 | engtime==4 | engtime==5
	replace eng_high=0 if engtime==6 | engtime==7 | engtime==8 | engtime==9 | engtime==10 | engtime==.
	label define eng_high_lbl 1">=50% time spent engaging the public" 0"<50% time spent engaging the public"
	label values eng_high eng_high_lbl
	tab eng_high
	tab eng_high, nolabel

rename Q1451_1 engfreq1a
label variable engfreq1a "engagement freqency_walk-ins from public"
label define engfreq1a_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1a engfreq1a_lbl
codebook engfreq1a
*reverse code
generate Rengfreq1a=8-engfreq1a
label define Rengfreq1a_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+times a week" 6"daily" 7"at least hourly"
label values Rengfreq1a Rengfreq1a_lbl
label variable Rengfreq1a"reversecoded_engagement frequency_walk-ins from public"
codebook Rengfreq1a

rename Q1451_2 engfreq1b
label variable engfreq1b "engagement frequency_public hearings"
label define engfreq1b_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1b engfreq1b_lbl
codebook engfreq1b
*reverse code
generate Rengfreq1b=8-engfreq1b
label define Rengfreq1b_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+times a week" 6"daily" 7"at least hourly"
label values Rengfreq1b Rengfreq1b_lbl
label variable Rengfreq1b"reversecoded_engagement frequency_public hearings"
codebook Rengfreq1b

rename Q1451_3 engfreq1c
label variable engfreq1c "engagement frequency_community meetings"
label define engfreq1c_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1c engfreq1c_lbl
codebook engfreq1c
*reverse code
generate Rengfreq1c=8-engfreq1c
label define Rengfreq1c_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1c Rengfreq1c_lbl
label variable Rengfreq1c"reversecoded_engagement frequency_community meetings"
codebook Rengfreq1c

rename Q1451_4 engfreq1d
label variable engfreq1d "engagement frequency_open meetings"
label define engfreq1d_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1d engfreq1d_lbl
codebook engfreq1d
*reverse code
generate Rengfreq1d=8-engfreq1d
label define Rengfreq1d_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1d Rengfreq1d_lbl
label variable Rengfreq1d"reversecoded_engagement frequency_open meetings"
codebook Rengfreq1d

rename Q1451_5 engfreq1e
label variable engfreq1e "engagement frequency_community outreach"
label define engfreq1e_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once permonth" 6"less than once per month" 7"never"
label values engfreq1e engfreq1e_lbl
codebook engfreq1e
*reverse code
generate Rengfreq1e=8-engfreq1e
label define Rengfreq1e_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1e Rengfreq1e_lbl
label variable Rengfreq1e"reversecoded_engagement frequency_community outreach"
codebook Rengfreq1e

rename Q1451_6 engfreq1f
label variable engfreq1f "engagement frequency_websites"
label define engfreq1f_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1f engfreq1f_lbl
codebook engfreq1f
*reverse code
generate Rengfreq1f=8-engfreq1f
label define Rengfreq1f_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1f Rengfreq1f_lbl
label variable Rengfreq1f "reversecoded_engagement frequency_websites"
codebook Rengfreq1f

rename Q1451_7 engfreq1g
label variable engfreq1g "engagement frequency_social media"
label define engfreq1g_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1g engfreq1g_lbl
codebook engfreq1g
*reverse code
generate Rengfreq1g=8-engfreq1g
label define Rengfreq1g_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1g Rengfreq1g_lbl
label variable Rengfreq1g "reversecoded_engagement frequency_social media"
codebook Rengfreq1g

rename Q1451_8 engfreq1h
label variable engfreq1h "engagement frequency_educational events"
label define engfreq1h_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1h engfreq1h_lbl
codebook engfreq1h
*reverse code
generate Rengfreq1h=8-engfreq1h
label define Rengfreq1h_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1h Rengfreq1h_lbl
label variable Rengfreq1h "reversecoded_engagement frequency_educational events"
codebook Rengfreq1h


rename Q1451_9 engfreq1i
label variable engfreq1i "engagement frequency_mailers/newsletters"
label define engfreq1i_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1i engfreq1i_lbl
codebook engfreq1i
*reverse code
generate Rengfreq1i=8-engfreq1i
label define Rengfreq1i_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1i Rengfreq1i_lbl
label variable Rengfreq1i "reversecoded_engagement frequency_mailers"
codebook Rengfreq1i

rename Q1451_10 engfreq1j
label variable engfreq1j "engagement frequency_open houses or ride alongs"
label define engfreq1j_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1j engfreq1j_lbl
codebook engfreq1j
*reverse code
generate Rengfreq1j=8-engfreq1j
label define Rengfreq1j_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1j Rengfreq1j_lbl
label variable Rengfreq1j "reversecoded_engagement_open houses and ride alongs"
codebook Rengfreq1j


rename Q1451_11 engfreq1k
label variable engfreq1k "engagement frequency_smartphone apps"
label define engfreq1k_lbl 1"at least hourly" 2"daily" 3"2+ times a week" 4"once per week" 5"once per month" 6"less than once per month" 7"never"
label values engfreq1k engfreq1k_lbl
codebook engfreq1k
*reverse code
generate Rengfreq1k=8-engfreq1k
label define Rengfreq1k_lbl 1"never" 2"less than once per month" 3"once per month" 4"once per week" 5"2+ times a week" 6"daily" 7"at least hourly"
label values Rengfreq1k Rengfreq1k_lbl
label variable Rengfreq1k "reversecoded_engagement frequency_smarthphone apps"
codebook Rengfreq1k


rename Q180 engagement1
label variable engagement1 "The majority of the interactions I have with the public arise out of mandates from my superiors."
label define engagement1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values engagement1 engagement1_lbl
codebook engagement1

	*generate dummy for mandated engagement
	gen engmandate=1 if engagement1>=5
	replace engmandate=0 if engmandate==.
	label variable engmandate "The majority of the interactions I have with the public arise out of mandates from my superiors"
	label define engmandate_lbl 1"agree" 0"otherwise"
	label values engmandate engmandate_lbl
	codebook engmandate

rename CE engagement3
label variable engagement3 "Engaging with the public directly is part of my job description."
label define engagement3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values engagement3 engagement3_lbl
codebook engagement3

	*generate dummy
	gen engagejob=1 if engagement3>=5		//Dummy: Engagement is part of my job description
	replace engagejob=0 if engagejob==.

rename Q172 racegeneng1
label variable racegeneng1 "Race & Gender - Cultural differences between citizens and employees in my department inhibit our ability to perform."
label define racegeneng1_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values racegeneng1 racegeneng1_lbl
codebook racegeneng1
*reverse code
generate Rracegeneng1=8-racegeneng1
label variable Rracegeneng1 "reversecode_race/gender engagement_cultural differences inhibit performance"
label define Rracegeneng1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values Rracegeneng1 Racegeneng1_lbl
codebook Rracegeneng1

	*generate 3-point scale
	gen racegeneng1_3scale=1 if racegeneng1<=3
	replace racegeneng1_3scale=2 if racegeneng1==4
	replace racegeneng1_3scale=3 if racegeneng1>=5
	label define racegeneng1_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values racegeneng1_3scale racegeneng1_3scale_lbl
	tab racegeneng1_3scale
	
	*generate dummy
	gen probculture=1 if racegeneng1<=3			//Dummy: Agree cultural differences inhibit performance
	replace probculture=0 if probculture==.


rename Q173 racegeneng2
label variable racegeneng2 "Race & Gender - My ethnic background is adequately represented in my department."
label define racegeneng2_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree" 
label values racegeneng2 racegeneng2_lbl
codebook racegeneng2
*reverse code
generate Rracegeneng2=8-racegeneng2
label variable Rracegeneng2 "reversecode_race/gender engagement_race represented in department"
label define Rracegeneng2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values Rracegeneng2 Rracegeneng2_lbl
codebook Rracegeneng2

rename Q178 racegeneng3
label variable racegeneng3 "Race & Gender - My gender is adequately represented in my department."
label define racegeneng3_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values racegeneng3 racegeneng3_lbl
codebook racegeneng3
*reverse code
generate Rracegeneng3=8-racegeneng3
label variable Rracegeneng3 "reversecode_race/gender engagement_gender represented in department"
label define Rracegeneng3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values Rracegeneng3 Rracegeneng3_lbl
codebook Rracegeneng3


rename Q174 racegeneng4
label variable racegeneng4 "Race & Gender - Which of the following most represents the ethnicity of the citizens you interact with most?"
label define racegeneng4_lbl 1"white/caucasian" 2"african american or black" 3"hispanic" 4"asian" 5"native american" 6"pacific islander" 7"other"
label values racegeneng4 racegeneng4_lbl
codebook racegeneng4

rename Q175 racegeneng5
label variable racegeneng5 "Race & Gender - I find ethnic differences between myself and citizens are easy to overcome in my job."
label define racegeneng5_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values racegeneng5 racegeneng5_lbl
codebook racegeneng5
*reverse code
generate Rracegeneng5=8-racegeneng5
label variable Rracegeneng5 "reversecoded_race/gender engagement_ethnic differences easy to overcome"
label define Rracegeneng5_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values Rracegeneng5 Rracegeneng5_lbl
codebook Rracegeneng5

	*generate 3-point scale
	gen racegeneng5_3scale=1 if racegeneng5<=3
	replace racegeneng5_3scale=2 if racegeneng5==4
	replace racegeneng5_3scale=3 if racegeneng5>=5
	label define racegeneng5_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values racegeneng5_3scale racegeneng5_3scale_lbl
	tab racegeneng5_3scale
	
	*generate dummy
	gen probethnic=1 if racegeneng5>=5			//Dummy: ethnic differences are problematic
	replace probethnic=0 if probethnic==.

rename Q181 racegeneng6
label variable racegeneng6 "Race & Gender - I find gender differences between myself and citizens are easy to overcome in my job."
label define racegeneng6_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values racegeneng6 racegeneng6_lbl
codebook racegeneng6
*reverse code
generate Rracegeneng6=8-racegeneng6
label variable Rracegeneng6 "reversecoded_race/gender engagement_gender differences easy to overcome"
label define Rracegeneng6_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values Rracegeneng6 Rracegeneng6_lbl
codebook Rracegeneng6

	*generate 3-point scale
	gen racegeneng6_3scale=1 if racegeneng6<=3
	replace racegeneng6_3scale=2 if racegeneng6==4
	replace racegeneng6_3scale=3 if racegeneng6>=5
	label define racegeneng6_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values racegeneng6_3scale racegeneng6_3scale_lbl
	tab racegeneng6_3scale
	
	*generate dummy
	gen probgender=1 if racegeneng6>=5			//Dummy: gender differences are problematic
	replace probgender=0 if probgender==.

rename Q589 responsive1
label variable responsive1 "I often find myself telling citizens something akin to 'the rule is the rule.'"
label define responsive1_lbl 1"strongly disagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values responsive1 responsive1_lbl
codebook responsive1
*reverse code
generate Rresponsive1=8-responsive1
label variable Rresponsive1 "reversecoded_i tell citizens the rule is the rule"
label define Rresponsive1_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rresponsive1 Rresponsive1_lbl
codebook Rresponsive1

rename Q591 responsive2
label variable responsive2 "I use citizen complaints to help inform the way I do my job."
label define responsive2_lbl 1"strongly disagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values responsive2 responsive2_lbl
codebook responsive2

rename CN responsive3
label variable responsive3 "Complaining citizens do not understand the importance of rules."
label define responsive3_lbl 1"strongly disagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values responsive3 responsive3_lbl
codebook responsive3
*reverse code
generate Rresponsive3=8-responsive3
label variable Rresponsive3 "reversecoded_complaining citizens don't understand the importance of rules"
label define Rresponsive3_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rresponsive3 Rresponsive3_lbl
codebook Rresponsive3


rename CO responsive4
label variable responsive4 "citizens do not know what they want"
label define responsive4_lbl 1"strongly disagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values responsive4 responsive4_lbl
codebook responsive4
*reverse code
generate Rresponsive4=8-responsive4
label variable Rresponsive4 "reversecoded_citizens do not know what they want"
label define Rresponsive4_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rresponsive4 Rresponsive4_lbl
codebook Rresponsive4


rename Q185 responsive5
label variable responsive5 "citizen participation is a good representation of publics interest"
label define responsive5_lbl 1"strongly disagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values responsive5 responsive5_lbl
codebook responsive5

rename Q186 responsive6
label variable responsive6 "citizen participation is an important part of my department"
label define responsive6_lbl 1"strongly disagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values responsive6 responsive6_lbl
codebook responsive6

	*generate average for engagement attitudes
	egen avg_eng_attitude = rowmean(Rresponsive1 responsive2 Rresponsive3 Rresponsive4 responsive5 responsive6)
	label variable avg_eng_attitude "Average Engagement Attitudes 1=Anti-Citizen, 7=Pro-Citizen"
	label define avg_eng_attitude_lbl 1"Anti-Citizen" 5"Pro-Citizen"
	label values avg_eng_attitude avg_eng_attitude_lbl
	codebook avg_eng_attitude
	
	*generate dummy for pro-citizen attitude
	gen procitizen=1 if avg_eng_attitude>4
	replace procitizen=0 if avg_eng_attitude<=4
	label variable procitizen "Pro-Citizen Attitude"
	label define procitizen_lbl 1"Pro-Citizen" 0"Anti-Citizen"
	label values procitizen procitizen_lbl
	codebook procitizen

rename Recall1 posrecall1
label variable posrecall1 "recall a positive experience you had engaging with a member of the public - text response"

rename Recall1a posrecall2
label variable posrecall2 "how recent was this interaction"
label define posrecall2_lbl 1"more than a year ago" 2"within the last 7-12 months" 3"within the last 4-6 months" 4"within the last 1-3 months" 5"within the last four weeks"
label values posrecall2 posrecall2_lbl
codebook posrecall2

rename Recall1b_1 posrecall3
label variable posrecall3 "On a scale of 0-100, how positively did this experience affect you personally?"

rename Recall1c_1 posrecall4
label variable posrecall4 "On a scale of 0 to 100, how positively did this experience affect your organization?"

rename Recall2 negrecall1
label variable negrecall1 "recall a negative experience you had engaging with the public - text response"

rename Q143 negrecall2
label variable negrecall2 "how recent was this interaction"
label define negrecall2_lbl 1"more than a year ago" 2"within the last 7-12 months" 3"within the last 4-6 months" 4"within the last 1-3 months" 5"within the last four weeks"
label values negrecall2 negrecall2_lbl
codebook negrecall2

rename Recall2a_1 negrecall3
label variable negrecall3 "On a scale of 0-100, how positively did this experience affect you personally?"

rename Recall2b_1 negrecall4
label variable negrecall4 "On a scale of 0 to 100, how positively did this experience affect your organization?"

rename Q642 controlrecall1
label variable controlrecall1 "recall an experience you had engaging with a member of the public"

rename Q643 controlrecall2
label variable controlrecall2 "how recent was this interaction"
label define controlrecall2_lbl 1"more than a year ago" 2"within the last 7-12 months" 3"within the last 4-6 months" 4"within the last 1-3 months" 5"within the last four weeks"
label values controlrecall2 controlrecall2_lbl
codebook controlrecall2

rename Q644_1 controlrecall3
label variable controlrecall3 "On a scale of -100 to +100,  how did this experience affect you personally (i.e., negatively or positively)?"

rename Q645_1 controlrecall4
label variable controlrecall4 "On a scale of -100 to +100,  how did this experience affect your organization (i.e., negatively or positively)?"

*generate recall treatment groups
	*positive recall group
	gen posrecallgroup = (posrecall1 !="." | posrecall2 !=. | posrecall3 !=. | posrecall4 !=.)
	tab posrecallgroup

	*negative recall group
	gen negrecallgroup = (negrecall1 !="." | negrecall2 !=. | negrecall3 !=. | negrecall4 !=.)
	tab negrecallgroup

	*control recall group
	gen controlrecallgroup = (controlrecall1 !="." | controlrecall2 !=. | controlrecall3 !=. | controlrecall4 !=.)
	tab controlrecallgroup

	*Recall Treatments
	su controlrecallgroup negrecallgroup posrecallgroup 
	pwcorr controlrecallgroup negrecallgroup posrecallgroup

	tab controlrecallgroup, su(posrecallgroup)
	tab controlrecallgroup, su(negrecallgroup)
	tab negrecallgroup, su(posrecallgroup)
	tab posrecallgroup, su(negrecallgroup)
	tab negrecallgroup, su(controlrecallgroup)

	**Generating Detail and Group variables
	gen recallpos_detail=length(posrecall1) if posrecallgroup==1
	gen recallpos_detail2=strlen(posrecall1) if posrecallgroup==1

	gen recallneg_detail=length(negrecall1) if negrecallgroup==1
	gen recallneg_detail2=strlen(negrecall1) if negrecallgroup==1

	gen recallcon_detail=length(controlrecall1) if controlrecallgroup==1
	gen recallcon_detail2=strlen(controlrecall1) if controlrecallgroup==1

	su recallpos_detail recallpos_detail2
	su recallneg_detail recallneg_detail2
	su recallcon_detail recallcon_detail2

	gen control=controlrecallgroup
	gen negative=negrecallgroup
	gen positive=posrecallgroup

	su control negative positive 
	pwcorr control negative positive

	tab control, su(positive)
	tab control, su(negative)
	tab negative, su(positive)
	tab positive, su(negative)
	tab negative, su(control)

	gen detail=recallneg_detail if negative==1
	replace detail=recallpos_detail if positive==1
	replace detail=recallcon_detail if control==1

	gen groups=0 if control==1
	replace groups=1 if negative==1
	replace groups=2 if positive==1
	gen treatment=1 if positive==1 | negative==1
	replace treatment=0 if control==1
	
	label define groups_lbl 0"control" 1"negative" 2"positive"
	label values groups groups_lbl
	tab groups

	tab treatment


rename ER1 extrarole1
label variable extrarole1 "In the LAST YEAR, how often (on average) have you done extra things that are not part of your job to help individual citizens?"
label define extrarole1_lbl 1"never" 2"less than once a month" 3"once a month" 4"two to three times a month" 5"two to three times a week" 6"daily"
label values extrarole1 extrarole1_lbl
codebook extrarole1

rename ER2 extrarole2
label variable extrarole2 "how much of your own money did you spend on job-related materials without reimbursement (whole dollars)"

rename DF extrarole3
label variable extrarole3 "how many hours per week did you work (whole hours)"

rename Q144 extrarole4
label variable extrarole4 "how many hours per week did you work without pay (whole hours)"

rename Q165 willengage1
label variable willengage1 "To what extent would you like to engage with citizens directly as a part of your job in the future?"
label define willengage1_lbl 1"like a great deal" 2"like a moderate amount" 3"like a little" 4"neither like nor dislike" 5"dislike a little" 6"dislike a moderate amount" 7"dislike a great deal"
label values willengage1 willengage1_lbl
codebook willengage1
*reverse code
generate Rwillengage1=8-willengage1
label variable Rwillengage1 "reversecoded_would you like to engage with citizens directly in the future"
label define Rwillengage1_lbl 1"dislike a great deal" 2"dislike a moderate amount" 3 "dislike a little" 4"neither like nor dislike" 5"like a little" 6"like a moderate amount" 7"like a great deal"
label values Rwillengage1 Rwillengage1_lbl
codebook Rwillengage1

rename DI willengage2
label variable willengage2 "I believe the way my department currently engages with citizens needs to change."
label define willengage2_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values willengage2 willengage2_lbl
codebook willengage2

	*generate 3-point scale
	gen willengage2_3scale=1 if willengage2<=3
	replace willengage2_3scale=2 if willengage2==4
	replace willengage2_3scale=3 if willengage2>=5
	label define willengage2_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values willengage2_3scale willengage2_3scale_lbl
	tab willengage2_3scale	//(1"agree" 2"neither" 3"disagree")

rename Q184 willengage3
label variable willengage3 "If it were up to me, I would interact with the public more often."
label define willengage3_lbl 1"strongly diagree" 2"disagree" 3"somewhat disagree" 4"neither agree nor disagree" 5"somewhat agree" 6"agree" 7"strongly agree"
label values willengage3 willengage3_lbl
codebook willengage3

	*generate dummy
	gen engagemore=1 if willengage1<=3 | willengage3>=5
	replace engagemore=0 if engagemore==.

	gen engageless=1 if willengage1>=5 | willengage3<=3
	replace engageless=0 if engageless==.
	
	*generate 3-point scale
	gen willengage3_3scale=1 if willengage3>=5
	replace willengage3_3scale=2 if willengage3==4
	replace willengage3_3scale=3 if willengage3<=3
	label define willengage3_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values willengage3_3scale willengage3_3scale_lbl
	tab willengage3_3scale	//(1"agree" 2"neither" 3"disagree")


rename Q167 willengage4
label variable willengage4 "select top 5 methods of citizen engagement"

/* treating my multiselect as a string
label define willengage4_lbl 1"public meetings" 2"employees' independent methods of engagement" 3"smartphone apps" 4"surveys" 5"citizen walk-ins" 6"citizen oversight boards and commissions" 7"social media" 8"community meetings" 9"websites" 10"educational events" 11"mailers/newsletters" 12"open house or ride alongs" 12"other"
label values willengage4 willengage4_lbl
codebook willengage4
*/

/*Need to generate these variables"
label variable willengage4a "most effective engagement methods_public meetings"
label variable willengage4b "most effective engagement methods_employees own methods"
label variable willengage4c "most effective engagement methods_smartphone apps"
label variable willengage4d "most effective engagement methods_surveys"
label variable willengage4e "most effective engagement methodscitizen walk-ins"
label variable willengage4f "most effective engagement methods_citizen boards or commissions"
label variable willengage4g "most effective engagement methods_social media"
label variable willengage4h "most effective engagement methods_community hearings"
label variable willengage4i "most effective engagement methods_websites"
label variable willengage4j "most effective engagement methods_educational events"
label variable willengage4k "most effective engagement methods_mailers/newsletters"
label variable willengage4l "most effective engagement methods_open houses or ride alongs"
label variable willengage4m "most effective engagement methods_other"
*/

rename Q167_13_TEXT willengage4_text
label variable willengage4_text "most effective engagement methods_other_text"

	*generate average
	egen willengageavg = rowmean(Rwillengage1 willengage3)


rename BI1 burnout1
label variable burnout1 "emotional exhaustion_i feele motionally drained from work"
label define burnout1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout1 burnout1_lbl
codebook burnout1

rename BI2 burnout2
label variable burnout2 "emotional exhaustion_working with people is a strain"
label define burnout2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout2 burnout2_lbl
codebook burnout2

rename BI3 burnout3
label variable burnout3 "emotional exhaustion_i feel burned out from my work"
label define burnout3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout3 burnout3_lbl
codebook burnout3

rename BI4 burnout4
label variable burnout4 "personal accomplishment_i deal effectively with problems of residents"
label define burnout4_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout4 burnout4_lbl
codebook burnout4
*reverse code
generate Rburnout4=8-burnout4
label variable Rburnout4 "reversecoded_personal accomplishment_i deal efffectively with residents problems"
label define Rburnout4_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5" somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rburnout4 Rburnout4_lbl
codebook Rburnout4

rename BI5 burnout5
label variable burnout5 "personal accomplishment_i'm positively influencing other people's lives"
label define burnout5_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout5 burnout5_lbl
codebook burnout5
*reverse code
generate Rburnout5=8-burnout5
label variable Rburnout5 "reversecoded_personal accomplishment_im positively influencing peoples lives"
label define Rburnout5_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5" somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rburnout5 Rburnout5_lbl
codebook Rburnout5


rename BI7 burnout7
label variable burnout7 "depersonalization_i worry this job is hardening me emotionally"
label define burnout7_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout7 burnout7_lbl
codebook burnout7

rename BI8 burnout8
label variable burnout8 "depersonalization_residents blame me for some of their problems"
label define burnout8_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout8 burnout8_lbl
codebook burnout8

rename BI9 burnout9
label variable burnout9 "involvement_i feel similar to residents in many ways"
label define burnout9_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout9 burnout9_lbl
codebook burnout9
*reverse code
generate Rburnout9=8-burnout9
label variable Rburnout9"reversecoded_ involvement_i feel similar to residents in many ways"
label define Rburnout9_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5" somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rburnout9 Rburnout9_lbl
codebook Rburnout9


rename BI10 burnout10
label variable burnout10 "involvement_i feel personally involved with residents"
label define burnout10_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values burnout10 burnout10_lbl
codebook burnout10
*reverse code
generate Rburnout10=8-burnout10
label variable Rburnout10"reversecoded_  involvement_i feel personally involved with residents"
label define Rburnout10_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5" somewhat disagree" 6"disagree" 7"strongly disagree"
label values Rburnout10 Rburnout10_lbl
codebook Rburnout10

	*generate burnout average
	egen burnoutavg = rowmean(burnout1 burnout2 burnout3 burnout7)


rename TI1 turnover1
label variable turnover1 "are you considering leaving your organization"
label define turnover1_lbl 1"no" 2"yes, to take another job within my agency" 3"yes, to take another job outside my agency but in municipal government" 4"yes, to take a job outside of municipal government but still in the public sector" 5"yes, to take a job in the private sector" 6"yes, to take a job in the nonprofic sector" 7"yes, to retire"
label values turnover1 turnover1_lbl
codebook turnover1

rename JS1 jobsat1
label variable jobsat1 "i am generally satisfied with my job"
label define jobsat1_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values jobsat1 jobsatt1_lbl
codebook jobsat1

	*generate 3-point scale
	gen jobsat1_3scale=1 if jobsat1>=5
	replace jobsat1_3scale=2 if jobsat1==4
	replace jobsat1_3scale=3 if jobsat1<=3
	label define jobsat1_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values jobsat1_3scale jobsat1_3scale_lbl
	tab jobsat1_3scale		//I am generally satisfied with my job (1=agree 2=neither 3=disagree)

rename JS2 jobsat2
label variable jobsat2 "if i had to decide all over again whenter to take this job, i would take it"
label define jobsat2_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values jobsat2 jobsat2_lbl
codebook jobsat2

	*generate 3-point scale
	gen jobsat2_3scale=1 if jobsat2>=5
	replace jobsat2_3scale=2 if jobsat2==4
	replace jobsat2_3scale=3 if jobsat2<=3
	label define jobsat2_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values jobsat2_3scale jobsat2_3scale_lbl
	tab jobsat2_3scale		//If I had to decide all over again whether or not to take this job, I would take it (1=agree 2=neither 3=disagree)


rename DY jobsat3
label variable jobsat3 "i am adequately paid for the work i do"
label define jobsat3_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neighter agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values jobsat3 jobsat3_lbl
codebook jobsat3
*reverse code
generate Rjobsat3=8-jobsat3
label variable Rjobsat3 "reversecoded_i am adequately paid for the work ido"
label define Rjobsat3_lbl 1"strongly disagree" 2"disagree" 3"disagree somewhat" 4"neither agree nor disagree" 5"agree somewhat" 6"agree" 7"strongly agree"
label values Rjobsat3 Rjobsat3_lbl
codebook Rjobsat3

	*generate 3-point scale
	gen jobsat3_3scale=1 if jobsat3<=3
	replace jobsat3_3scale=2 if jobsat3==4
	replace jobsat3_3scale=3 if jobsat3>=5
	label define jobsat3_3scale_lbl 1"agree" 2"neither agree nor disagree" 3"disagree"
	label values jobsat3_3scale jobsat3_3scale_lbl
	tab jobsat3_3scale 		//Overall, I am adequately paid for the work I do(1=agree 2=neither 3=disagree)

rename Yang1 yang1
label variable yang1 "citizen experience_citizens generally very cooperative"
label define yang1_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values yang1 yang1_lbl
codebook yang1

rename Yang2 yang2
label variable yang2 "citizen experience_citizens were committed during duration of program"
label define yang2_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values yang2 yang2_lbl
codebook yang2

rename Yang3 yang3
label variable yang3 "citizen experience_organizational goals achieved"
label define yang3_lbl 1"strongly agree" 2"agree" 3"somewhat agree" 4"neither agree nor disagree" 5"somewhat disagree" 6"disagree" 7"strongly disagree"
label values yang3 yang3_lbl
codebook yang3

factor emplead1-emplead4, pcf factors(3)
alpha emplead1-emplead4, item
predict employee_engagement
su employee_engagement
tab agency, su(employee_engagement)

egen employee_engage_total = rowtotal(emplead1-emplead4)
su employee_engage_total
tab agency, su(employee_engage_total)

factor manager1-manager4, pcf factors(3)
alpha manager1-manager4, item
predict manager_engagement
su manager_engagement
tab agency, su(manager_engagement)

gen manager_engagement_total = manager1 + manager2 + manager3 + manager4
su manager_engagement_total
tab agency, su(manager_engagement_total)

**by agency, we want differences between employee engagement and manager engagement
**we have to input manager_engagement to employee observations and vice-versa
**bill will do this

****NEW ANALYSIS FOR RED TAPE PAPER**************
******************
******************
******************
******************
******************
******************
*****************************
*******
******************
******************

******
******************
******************
******************
******************

******
******************
******************
******************
******************
******************
******************
******************
******************
******************


////////////////////////////////////////////////////////////////////////////////


/*List of Departments for Reference

1"Aging" 
2"Airports" 
3"Animal Services" 
4"Building & Safety" 
5"Canabis Regulation" 
6"City Administrative Office" 
7"City Attorney" 
8"City Clerk" 
9"City Employees Retirement System" 
10"City Ethics Commission" 
11"City Planning" 
12"Controller" 
13"Convention & Tourism Development Department" 
14"Council" 
15"Cultural Affairs" 
16"Disability" 
17"Economic & Workforce Development Department" 
18"El Pueblo De Los Angeles Historical Monument Authority" 
19"Emergency"
20"Fire" 
21"General Services"
22"Harbor"
23"Housing and Community Investment Department"
24"Information Technology Agency"
25"Library"
26"Mayor"
27"Neighborhood Empowerment"
28"Office of Finance"
29"Pensions"
30"Personnel"
31"Police"
32"Public Works"
33"Recreation & Parks"
34"Transportation"
35"Water & Power"
36"Zoo"
37"Other"

*/


////////////////////////////////////////////////////////////////////////////////
/*GENERATE TOTAL VARIABLES - INDEXES OF KEY CONSTRUCTS*/

*total prosocial motivation
egen totalprosocial = rowtotal(prosocial1-prosocial4)
*total psychological empowerment
egen totalpsychemp = rowtotal(psychemp1-psychemp4)
*total red tape
egen totalredtape = rowtotal(rt_burden rt_unnecess rt_ineffect)
*total burnout
egen totalburnout = rowtotal(burnout1-burnout3 Rburnout4 Rburnout5 burnout7 burnout8 Rburnout9 Rburnout10)
*total job satisfaction
egen totaljobsat = rowtotal(jobsat1 jobsat2 Rjobsat3)

	/*QUESTION: what's the best way to treat missing values?  
	They're currently being dropped across the entire observation*/


////////////////////////////////////////////////////////////////////////////////
/*GENERATE ADDITIONAL INDEPENDENT VARAIBLES*/
   
**High Engagement Expectations or Not
label values engtime engtime_lbl
codebook engtime
tab engtime
tab engtime, nolabel
gen engageover50=1 if engtime>5
replace engageover50=0 if engageover50==.

**Willingness Toward Future Engagement
tab Rwillengage1
tab Rwillengage1, nolabel
gen futengage=1 if Rwillengage1>4
replace futengage=0 if futengage==.

////////////////////////////////////////////////////////////////////////////////
/* GENERATING DESCRIPTIVE STATISTICS */

tab agency
tab race2
tab gender1
tab agency race2, col row
tab agency gender1, col row

*Describing the treatment groups
tab controlrecallgroup
tab posrecallgroup
tab negrecallgroup

*Willingness toward Future Engagement (WFE)
tab futengage
summarize futengage

*red tape

tab rt_burden 
tab rt_unnecess 
tab rt_ineffect 
summarize rt_burden rt_unnecess rt_ineffect


////////////////////////////////////////////////////////////////////////////////
*NECESSARY STATISTICS WITHIN PAPER
////////////////////////////////////////////////////////////////////////////////

*String length for recall responses by group
	su recallpos_detail recallpos_detail2 
		//m: 110 	sd:114	max: 883
	su recallneg_detail recallneg_detail2
		//m: 121 	sd:203	max: 2837	
	su recallcon_detail recallcon_detail2
		//m: 115 	sd:152	max: 1202
		
* Mean and Standard Deviation of Future Engagement (dichotomous)
	tab futengage 
		//3,309 	73.86%
	su futengage
		//m:.739	sd:.439
		
* Mean and SD of Red Tape versions
	su totalredtape rt_burden rt_unnecess rt_ineffect
		//TIRT			m:5.67	sd:4.93
		//burden		m:3.69	sd:2.10
		//necessity		m:1.71	sd:1.69
		//effectiveness	m:1.61	sd:1.85

* %WFE by group
	tab futengage group, col
		//control 58.59%
		//negative 60.07%
		//positive 62.59%


	
cibar futengage, over1(groups) l(95)


////////////////////////////////////////////////////////////////////////////////
*NECESSARY GRAPHS FOR PAPER
////////////////////////////////////////////////////////////////////////////////
********************************************************************************	
*FIGURE 1. RESEARCH DESIGN

********************************************************************************	
*FIGURE 2. Overlaid Histograms of TIRT Items

twoway (hist rt_burden, frac lcolor(gs12) fcolor(gs12)) /// 
(hist rt_unnecess, frac fcolor(none) lcolor(red)), /// 
legend(off) xtitle("gray: Burden (red: Unneccessary)") saving(hist1, replace)

twoway (hist rt_burden, frac lcolor(gs12) fcolor(gs12)) /// 
(hist rt_ineffect, frac fcolor(none) lcolor(black)), /// 
legend(off) xtitle("gray: Burden (black: Ineffectiveness)") saving(hist2, replace)

twoway (hist rt_unnecess, frac lcolor(red) fcolor(red)) /// 
(hist rt_ineffect, frac fcolor(none) lcolor(black)), /// 
legend(off) xtitle("red: Unnecessary (black: Ineffectiveness)") saving(hist3, replace)

graph combine hist1.gph hist2.gph hist3.gph, c(1) saving(redtape_histograms, replace)

********************************************************************************	
*TABLE 1. Descriptive Statistics

summarize futengage willengage1 totalredtape rt_burden rt_unnecess rt_ineffect elected careerist appointee female yrborn educ polview rolsupervise

********************************************************************************	
*TABLE 2. Randomization Check

su futengage willengage1 totalredtape rt_burden rt_unnecess rt_ineffect elected careerist appointee female yrborn educ polview rolsupervise if control==1
su futengage willengage1 totalredtape rt_burden rt_unnecess rt_ineffect elected careerist appointee female yrborn educ polview rolsupervise if negative==1
su futengage willengage1 totalredtape rt_burden rt_unnecess rt_ineffect elected careerist appointee female yrborn educ polview rolsupervise if positive==1

tab futengage
summarize futengage

********************************************************************************	
*TABLE 3. Logistic Regression Results for WFE
logit futengage i.groups##c.totalredtape i.agency if engtime>1, cluster(agency)		//TIRT SUMMATIVE
logit futengage i.groups##c.rt_burden i.agency if engtime>1, cluster(agency)		//BURDEN
logit futengage i.groups##c.rt_unnecess i.agency if engtime>1, cluster(agency)		//NECESSITY
logit futengage i.groups##c.rt_ineffect i.agency if engtime>1, cluster(agency)		//EFFECTIVENESS

tab engtime

logit futengage i.groups##c.totalredtape i.agency if engtime>1, cluster(agency)		//TIRT SUMMATIVE
logit futengage i.groups##c.rt_burden i.agency if engtime>1, cluster(agency)		//BURDEN
logit futengage i.groups##c.rt_unnecess i.agency if engtime>1, cluster(agency)		//NECESSITY
logit futengage i.groups##c.rt_ineffect i.agency if engtime>1, cluster(agency)		//EFFECTIVENESS


********************************************************************************


	
////////////////////////////////////////////////////////////////////////////////
//POST-HOC TEXTUAL ANALYSIS 

*word search through negrecall1 and posrecall1 for redtape-related terms
gen rulementionneg=strpos(negrecall1, "rule") > 0
replace rulementionneg=1 if strpos(negrecall1, "admin")>0
replace rulementionneg=1 if strpos(negrecall1, "bookkeeping")>0
replace rulementionneg=1 if strpos(negrecall1, "burden")>0
replace rulementionneg=1 if strpos(negrecall1, "code")>0
replace rulementionneg=1 if strpos(negrecall1, "compl")>0
replace rulementionneg=1 if strpos(negrecall1, "constrain")>0
replace rulementionneg=1 if strpos(negrecall1, "control")>0
replace rulementionneg=1 if strpos(negrecall1, "delay")>0
replace rulementionneg=1 if strpos(negrecall1, "enforce")>0
replace rulementionneg=1 if strpos(negrecall1, "file")>0
replace rulementionneg=1 if strpos(negrecall1, "force")>0
replace rulementionneg=1 if strpos(negrecall1, "form")>0
replace rulementionneg=1 if strpos(negrecall1, "govern")>0
replace rulementionneg=1 if strpos(negrecall1, "guideline")>0
replace rulementionneg=1 if strpos(negrecall1, "impose")>0
replace rulementionneg=1 if strpos(negrecall1, "interven")>0
replace rulementionneg=1 if strpos(negrecall1, "law")>0
replace rulementionneg=1 if strpos(negrecall1, "obey")>0
replace rulementionneg=1 if strpos(negrecall1, "oversight")>0
replace rulementionneg=1 if strpos(negrecall1, "paperwork")>0
replace rulementionneg=1 if strpos(negrecall1, "policy")>0
replace rulementionneg=1 if strpos(negrecall1, "policies")>0
replace rulementionneg=1 if strpos(negrecall1, "proce")>0
replace rulementionneg=1 if strpos(negrecall1, "proper")>0
replace rulementionneg=1 if strpos(negrecall1, "regulat")>0
replace rulementionneg=1 if strpos(negrecall1, "requir")>0
replace rulementionneg=1 if strpos(negrecall1, "restrict")>0
replace rulementionneg=1 if strpos(negrecall1, "sanction")>0
replace rulementionneg=1 if strpos(negrecall1, "specific")>0
replace rulementionneg=1 if strpos(negrecall1, "standard")>0
replace rulementionneg=1 if strpos(negrecall1, "step")>0
replace rulementionneg=1 if strpos(negrecall1, "violat")>0
replace rulementionneg=1 if strpos(negrecall1, "appropriate")>0
replace rulementionneg=1 if strpos(negrecall1, "bills")>0
replace rulementionneg=1 if strpos(negrecall1, "citation")>0
replace rulementionneg=1 if strpos(negrecall1, "closed")>0
replace rulementionneg=1 if strpos(negrecall1, "couldn't")>0
replace rulementionneg=1 if strpos(negrecall1, "could not")>0
replace rulementionneg=1 if strpos(negrecall1, "detail")>0
replace rulementionneg=1 if strpos(negrecall1, "direct")>0
replace rulementionneg=1 if strpos(negrecall1, "had to")>0
replace rulementionneg=1 if strpos(negrecall1, "has to")>0
replace rulementionneg=1 if strpos(negrecall1, "have to")>0
replace rulementionneg=1 if strpos(negrecall1, "licens")>0
replace rulementionneg=1 if strpos(negrecall1, "must")>0
replace rulementionneg=1 if strpos(negrecall1, "need to")>0
replace rulementionneg=1 if strpos(negrecall1, "needs to")>0
replace rulementionneg=1 if strpos(negrecall1, "order")>0
replace rulementionneg=1 if strpos(negrecall1, "ordinance")>0
replace rulementionneg=1 if strpos(negrecall1, "petition")>0
replace rulementionneg=1 if strpos(negrecall1, "prohibit")>0
replace rulementionneg=1 if strpos(negrecall1, "protocol")>0
replace rulementionneg=1 if strpos(negrecall1, "register")>0
replace rulementionneg=1 if strpos(negrecall1, "report")>0
replace rulementionneg=1 if strpos(negrecall1, "transfer")>0
replace rulementionneg=0 if rulementionneg==.

gen rulementionpos=strpos(posrecall1, "rule") > 0
replace rulementionpos=1 if strpos(posrecall1, "admin")>0
replace rulementionpos=1 if strpos(posrecall1, "bookkeeping")>0
replace rulementionpos=1 if strpos(posrecall1, "burden")>0
replace rulementionpos=1 if strpos(posrecall1, "code")>0
replace rulementionpos=1 if strpos(posrecall1, "compl")>0
replace rulementionpos=1 if strpos(posrecall1, "constrain")>0
replace rulementionpos=1 if strpos(posrecall1, "control")>0
replace rulementionpos=1 if strpos(posrecall1, "delay")>0
replace rulementionpos=1 if strpos(posrecall1, "enforce")>0
replace rulementionpos=1 if strpos(posrecall1, "file")>0
replace rulementionpos=1 if strpos(posrecall1, "force")>0
replace rulementionpos=1 if strpos(posrecall1, "form")>0
replace rulementionpos=1 if strpos(posrecall1, "govern")>0
replace rulementionpos=1 if strpos(posrecall1, "guideline")>0
replace rulementionpos=1 if strpos(posrecall1, "impose")>0
replace rulementionpos=1 if strpos(posrecall1, "interven")>0
replace rulementionpos=1 if strpos(posrecall1, "law")>0
replace rulementionpos=1 if strpos(posrecall1, "obey")>0
replace rulementionpos=1 if strpos(posrecall1, "oversight")>0
replace rulementionpos=1 if strpos(posrecall1, "paperwork")>0
replace rulementionpos=1 if strpos(posrecall1, "policy")>0
replace rulementionpos=1 if strpos(posrecall1, "policies")>0
replace rulementionpos=1 if strpos(posrecall1, "proce")>0
replace rulementionpos=1 if strpos(posrecall1, "proper")>0
replace rulementionpos=1 if strpos(posrecall1, "regulat")>0
replace rulementionpos=1 if strpos(posrecall1, "requir")>0
replace rulementionpos=1 if strpos(posrecall1, "restrict")>0
replace rulementionpos=1 if strpos(posrecall1, "sanction")>0
replace rulementionpos=1 if strpos(posrecall1, "specific")>0
replace rulementionpos=1 if strpos(posrecall1, "standard")>0
replace rulementionpos=1 if strpos(posrecall1, "step")>0
replace rulementionpos=1 if strpos(posrecall1, "violat")>0
replace rulementionpos=1 if strpos(posrecall1, "appropriate")>0
replace rulementionpos=1 if strpos(posrecall1, "bills")>0
replace rulementionpos=1 if strpos(posrecall1, "citation")>0
replace rulementionpos=1 if strpos(posrecall1, "closed")>0
replace rulementionpos=1 if strpos(posrecall1, "couldn't")>0
replace rulementionpos=1 if strpos(posrecall1, "could not")>0
replace rulementionpos=1 if strpos(posrecall1, "detail")>0
replace rulementionpos=1 if strpos(posrecall1, "direct")>0
replace rulementionpos=1 if strpos(posrecall1, "had to")>0
replace rulementionpos=1 if strpos(posrecall1, "has to")>0
replace rulementionpos=1 if strpos(posrecall1, "have to")>0
replace rulementionpos=1 if strpos(posrecall1, "licens")>0
replace rulementionpos=1 if strpos(posrecall1, "must")>0
replace rulementionpos=1 if strpos(posrecall1, "need to")>0
replace rulementionpos=1 if strpos(posrecall1, "needs to")>0
replace rulementionpos=1 if strpos(posrecall1, "order")>0
replace rulementionpos=1 if strpos(posrecall1, "ordinance")>0
replace rulementionpos=1 if strpos(posrecall1, "petition")>0
replace rulementionpos=1 if strpos(posrecall1, "prohibit")>0
replace rulementionpos=1 if strpos(posrecall1, "protocol")>0
replace rulementionpos=1 if strpos(posrecall1, "register")>0
replace rulementionpos=1 if strpos(posrecall1, "report")>0
replace rulementionpos=1 if strpos(posrecall1, "transfer")>0
replace rulementionpos=0 if rulementionpos==.

gen rulementioncontrol=1 if strpos(controlrecall1, "admin")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "bookkeeping")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "burden")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "code")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "compl")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "constrain")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "control")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "delay")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "enforce")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "file")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "force")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "form")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "govern")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "guideline")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "impose")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "interven")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "law")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "obey")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "oversight")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "paperwork")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "policy")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "policies")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "proce")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "proper")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "regulat")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "requir")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "restrict")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "sanction")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "specific")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "standard")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "step")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "violat")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "appropriate")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "bills")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "citation")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "closed")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "couldn't")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "could not")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "detail")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "direct")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "had to")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "has to")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "have to")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "licens")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "must")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "need to")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "needs to")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "order")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "ordinance")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "petition")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "prohibit")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "protocol")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "register")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "report")>0
replace rulementioncontrol=1 if strpos(controlrecall1, "transfer")>0
replace rulementioncontrol=0 if rulementioncontrol==.


summarize rulementioncontrol
tab rulementioncontrol

gen rulemention=1 if rulementionpos==1 | rulementionneg==1 | rulementioncontrol==1
replace rulemention=0 if rulemention==.

tab rulemention //798 mentions

gen treat=1 if groups==1
replace treat=2 if groups==2
replace treat=0 if groups==0

**generate recency variable
gen recency=posrecall2
replace recency=negrecall2
replace recency=controlrecall2

tab recency


********************************************************************************
*DEDUCTIVE ONLY word search

gen drulementionneg=strpos(negrecall1, "rule") > 0
replace drulementionneg=1 if strpos(negrecall1, "admin")>0
replace drulementionneg=1 if strpos(negrecall1, "bookkeeping")>0
replace drulementionneg=1 if strpos(negrecall1, "burden")>0
replace drulementionneg=1 if strpos(negrecall1, "code")>0
replace drulementionneg=1 if strpos(negrecall1, "compl")>0
replace drulementionneg=1 if strpos(negrecall1, "constrain")>0
replace drulementionneg=1 if strpos(negrecall1, "control")>0
replace drulementionneg=1 if strpos(negrecall1, "delay")>0
replace drulementionneg=1 if strpos(negrecall1, "enforce")>0
replace drulementionneg=1 if strpos(negrecall1, "file")>0
replace drulementionneg=1 if strpos(negrecall1, "force")>0
replace drulementionneg=1 if strpos(negrecall1, "form")>0
replace drulementionneg=1 if strpos(negrecall1, "govern")>0
replace drulementionneg=1 if strpos(negrecall1, "guideline")>0
replace drulementionneg=1 if strpos(negrecall1, "impose")>0
replace drulementionneg=1 if strpos(negrecall1, "interven")>0
replace drulementionneg=1 if strpos(negrecall1, "law")>0
replace drulementionneg=1 if strpos(negrecall1, "obey")>0
replace drulementionneg=1 if strpos(negrecall1, "oversight")>0
replace drulementionneg=1 if strpos(negrecall1, "paperwork")>0
replace drulementionneg=1 if strpos(negrecall1, "policy")>0
replace drulementionneg=1 if strpos(negrecall1, "policies")>0
replace drulementionneg=1 if strpos(negrecall1, "proce")>0
replace drulementionneg=1 if strpos(negrecall1, "proper")>0
replace drulementionneg=1 if strpos(negrecall1, "regulat")>0
replace drulementionneg=1 if strpos(negrecall1, "requir")>0
replace drulementionneg=1 if strpos(negrecall1, "restrict")>0
replace drulementionneg=1 if strpos(negrecall1, "sanction")>0
replace drulementionneg=1 if strpos(negrecall1, "specific")>0
replace drulementionneg=1 if strpos(negrecall1, "standard")>0
replace drulementionneg=1 if strpos(negrecall1, "step")>0
replace drulementionneg=1 if strpos(negrecall1, "violat")>0

replace drulementionneg=0 if drulementionneg==.

gen drulementionpos=strpos(posrecall1, "rule") > 0
replace drulementionpos=1 if strpos(posrecall1, "admin")>0
replace drulementionpos=1 if strpos(posrecall1, "bookkeeping")>0
replace drulementionpos=1 if strpos(posrecall1, "burden")>0
replace drulementionpos=1 if strpos(posrecall1, "code")>0
replace drulementionpos=1 if strpos(posrecall1, "compl")>0
replace drulementionpos=1 if strpos(posrecall1, "constrain")>0
replace drulementionpos=1 if strpos(posrecall1, "control")>0
replace drulementionpos=1 if strpos(posrecall1, "delay")>0
replace drulementionpos=1 if strpos(posrecall1, "enforce")>0
replace drulementionpos=1 if strpos(posrecall1, "file")>0
replace drulementionpos=1 if strpos(posrecall1, "force")>0
replace drulementionpos=1 if strpos(posrecall1, "form")>0
replace drulementionpos=1 if strpos(posrecall1, "govern")>0
replace drulementionpos=1 if strpos(posrecall1, "guideline")>0
replace drulementionpos=1 if strpos(posrecall1, "impose")>0
replace drulementionpos=1 if strpos(posrecall1, "interven")>0
replace drulementionpos=1 if strpos(posrecall1, "law")>0
replace drulementionpos=1 if strpos(posrecall1, "obey")>0
replace drulementionpos=1 if strpos(posrecall1, "oversight")>0
replace drulementionpos=1 if strpos(posrecall1, "paperwork")>0
replace drulementionpos=1 if strpos(posrecall1, "policy")>0
replace drulementionpos=1 if strpos(posrecall1, "policies")>0
replace drulementionpos=1 if strpos(posrecall1, "proce")>0
replace drulementionpos=1 if strpos(posrecall1, "proper")>0
replace drulementionpos=1 if strpos(posrecall1, "regulat")>0
replace drulementionpos=1 if strpos(posrecall1, "requir")>0
replace drulementionpos=1 if strpos(posrecall1, "restrict")>0
replace drulementionpos=1 if strpos(posrecall1, "sanction")>0
replace drulementionpos=1 if strpos(posrecall1, "specific")>0
replace drulementionpos=1 if strpos(posrecall1, "standard")>0
replace drulementionpos=1 if strpos(posrecall1, "step")>0
replace drulementionpos=1 if strpos(posrecall1, "violat")>0

replace drulementionpos=0 if drulementionpos==.

gen drulementioncontrol=1 if strpos(controlrecall1, "admin")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "bookkeeping")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "burden")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "code")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "compl")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "constrain")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "control")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "delay")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "enforce")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "file")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "force")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "form")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "govern")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "guideline")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "impose")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "interven")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "law")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "obey")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "oversight")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "paperwork")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "policy")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "policies")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "proce")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "proper")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "regulat")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "requir")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "restrict")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "sanction")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "specific")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "standard")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "step")>0
replace drulementioncontrol=1 if strpos(controlrecall1, "violat")>0

replace drulementioncontrol=0 if drulementioncontrol==.


summarize rulementioncontrol
tab rulementioncontrol

gen drulemention=1 if drulementionpos==1 | drulementionneg==1 | drulementioncontrol==1
replace drulemention=0 if drulemention==.

tab drulementionpos			//194 mentions
tab drulementionneg 		//207 mentions
tab drulementioncontrol 	//189 mentions
tab drulemention 			//590 mentions

tab groups drulemention, row
	//control	23.02%
	//negative	25.27%
	//positive	23.04%

cibar drulemention, over1(groups)


********************************************************************************	
*Procedural Reference Section
tab rulementionpos		//274 mentions
tab rulementionneg 		//256 mentions
tab rulementioncontrol 	//268 mentions
tab rulemention 		//798 mentions

tab groups rulemention, row
	//control	32.6%
	//negative	31.3%
	//positive	32.5%

*FIGURE A1. Rule Mention Across Treatment Groups 

cibar rulemention, over1(groups)
cibar rulemention if engtime>1, over1(groups)

tab groups, su(rulemention)
   
   /*ADDITIONAL ANALYSIS REQUESTS FROM BILL RESH*/

/*This is some additional analysis that Bill Resh would like me to complete for 
the purposes of a paper we seek to write together based on this data.  The code 
is placeholder for now* as some of the variables are labeled slightly differently*/ 

*word search through negrecall1 and posrecall1 for redtape-related terms
	
cibar rulemention, over1(groups)

logit rulemention i.groups##c.totalredtape i.agency, cluster(agency)

est sto mod5_tirt
su totalredtape, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(totalredtape=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto rulemention_tirt_logit
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("Procedural References in Recall", m(right)) ///
	xtitle("Red Tape", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod5_tirt, replace) saving(mod5_tirt, replace)

**Model 1: TIRT

	/*Note: when I try to run this code (switching muni with agency) 
	I get errors starting with plot2 command*/

logit futengage i.groups##c.totalredtape i.agency if engtime>1, cluster(agency)

est sto mod1_tirt
su totalredtape, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(totalredtape=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto futengage_tirt_logit
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("WFE", m(right)) ///
	xtitle("Red Tape", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod1_tirt, replace) saving(mod1_tirt, replace)
	
**Model 2: Burden

logit futengage i.groups##c.rt_burden i.agency if engtime>1, cluster(agency)

est sto mod2_burden
su rt_burden, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(rt_burden=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto futengage_burden_logit
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("WFE", m(right)) ///
	xtitle("Burden", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod2_burden, replace) saving(mod2_burden, replace)

**Model 3: Unnecessary

logit futengage i.groups##c.rt_unnecess i.agency if engtime>1, cluster(agency)

est sto mod3_unnecess
su rt_unnecess, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(rt_unnecess=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto futengage_unnecess_logit
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("WFE", m(right)) ///
	xtitle("Unnecessity", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod3_unnecess, replace) saving(mod3_unnecess, replace)

**Model 4: Ineffectiveness

logit futengage i.groups##c.rt_ineffect i.agency if engtime>1, cluster(agency)

est sto mod4_ineffect
su rt_ineffect, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(rt_ineffect=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto futengage_ineffect_logit
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("WFE", m(right)) ///
	xtitle("Ineffectiveness", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod4_ineffect, replace) saving(mod4_ineffect, replace)


graph combine mod1_tirt.gph mod2_burden.gph mod3_unnecess.gph mod4_ineffect.gph, saving(redtapemods, replace)
	
	

/**Robustness Checks\
set matsize 4000
mlogit engagefut1 i.groups##c.rt_burden i.muni, base(1) cluster(muni)

margins, dydx(*) post
margins, dydx(X2) over(X1)
margins, dydx(X2) at (X1=(0 1))
*/
compress
